package com.kabigon.multiverse.controller;

import com.kabigon.multiverse.exception.UnauthorizedException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试Controller
 *
 * @author xu.biao
 * @version v1.0
 * @Package com.kabigon.multiverse.controller
 * @data 2022/2/17 21:35
 */
@RestController
@RequestMapping("/demo")
public class ReturnController {

    @GetMapping("/getStr")
    public String getStr() {
        return "龟兔赛跑";
    }

    @GetMapping("/wrong")
    public int error() {
        int i = 9 / 0;
        return i;
    }

    @GetMapping("/error")
    public void getError() {
        throw new UnauthorizedException("暂未登录或token已经过期的异常");
    }



}
